package com.jeecms.edu.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;
import com.jeecms.common.web.ResponseUtils;
import com.jeecms.edu.entity.SchoolInformation;

/**
 * list页面中的热门学校
 */
@WebServlet("/ShowAllHotSchool")
public class ShowAllHotSchool extends HttpServlet {
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		List alllist=SchoolInformation.AllHotSchoolList();
		PrintWriter writer=response.getWriter();
		
		//热门学校
		String allresult="";		//热门学校集合
		int allsize=alllist.size();	
		if (alllist.size()>7) {   //增加显示数量限制
			allsize=7;
		}
		for (int i = 0; i < allsize; i++) {
			Map map=(Map) alllist.get(i);
			String school=(String) map.get("schoolname");
			String changes="javascript:gotoDetail('"+school+"');";
			allresult+="<div class='hot_thread1'><a href="+changes+"><img src='"+map.get("schoolimgurl")+"' class='hot_pic' /></a>"
						+"<p><a href="+changes+">"+map.get("schoolname")+"</a></p><p>"+map.get("region")+"  "+map.get("schoolnature")+"</p></div>";
		}
		writer.append(allresult);
		writer.flush();
		writer.close();
	}
}
